package org.lisen.runner;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Set;

/**
 * 顺序号103
 *
 * @author laughing
 * @date 2020/9/26
 * @site https://www.lisen.org
 */
@Component
@Order(103)
public class MyApplicationRunner103 implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) {
        System.out.println("开始输出103的ApplicationRunner");
        System.out.println("开始输出103可选参数");
        Set<String> optionNames = args.getOptionNames();
        for (String optionName : optionNames) {
            System.out.println(args.getOptionValues(optionName));
        }
        System.out.println("可选参数103输出完毕");
        System.out.println("开始输出103非可选参数");
        List<String> nonOptionArgs = args.getNonOptionArgs();
        for (String nonOptionArg : nonOptionArgs) {
            System.out.println(nonOptionArg);
        }
        System.out.println("非可选参数103输出完毕");
    }
}
